package com.party.core.model.member;

import com.party.core.model.BaseModel;
import org.springframework.beans.BeanUtils;

/**
 * 合伙人数据总统计
 * Created by wei.li.
 *
 * @date 2018/1/15 0015
 * @time 14:17
 */
public class MemberCopartnerCount extends BaseModel {
    private static final long serialVersionUID = 6142341141886567667L;
    // 会员编号
    private String memberId;
    // 报名数
    private Integer applyNum;
    // 订单数
    private Integer orderNum;
    // 众筹成功
    private Integer successNum;
    // 累计资金
    private Double totalMoney;
    // 累计佣金（包含下级）
    private Double totalBrokerage;
    // 我的直接佣金（不包含下级）
    private Double myBrokerage;
    // 未结算佣金
    private Double notBalance;
    // 可提现佣金
    private Double canWithdrawal;

    //合伙人
    private Integer lowerNum;

    //自己获得的佣金
    private Float myCommission;

    public MemberCopartnerCount() {
    }

    public MemberCopartnerCount(Integer applyNum, Integer orderNum, Integer successNum, Double totalMoney,
                                Double totalBrokerage, Double myBrokerage, Double notBalance, Double canWithdrawal) {
        this.applyNum = applyNum;
        this.orderNum = orderNum;
        this.successNum = successNum;
        this.totalMoney = totalMoney;
        this.totalBrokerage = totalBrokerage;
        this.myBrokerage = myBrokerage;
        this.notBalance = notBalance;
        this.canWithdrawal = canWithdrawal;
    }

    public static MemberCopartnerCount transform(CopartnerAnalyze copartnerAnalyze) {
        MemberCopartnerCount memberCopartnerCount = new MemberCopartnerCount();
        BeanUtils.copyProperties(copartnerAnalyze, memberCopartnerCount);
        return memberCopartnerCount;
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public Integer getApplyNum() {
        return applyNum;
    }

    public void setApplyNum(Integer applyNum) {
        this.applyNum = applyNum;
    }

    public Integer getOrderNum() {
        return null == orderNum ? 0 : orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public Integer getSuccessNum() {
        return successNum;
    }

    public void setSuccessNum(Integer successNum) {
        this.successNum = successNum;
    }

    public Double getTotalMoney() {
        return null == totalMoney ? 0d : totalMoney;
    }

    public void setTotalMoney(Double totalMoney) {
        this.totalMoney = totalMoney;
    }

    public Double getTotalBrokerage() {
        return totalBrokerage;
    }

    public void setTotalBrokerage(Double totalBrokerage) {
        this.totalBrokerage = totalBrokerage;
    }

    public Integer getLowerNum() {
        return lowerNum;
    }

    public void setLowerNum(Integer lowerNum) {
        this.lowerNum = lowerNum;
    }

    public Float getMyCommission() {
        return myCommission;
    }

    public void setMyCommission(Float myCommission) {
        this.myCommission = myCommission;
    }

    public Double getMyBrokerage() {
        return myBrokerage;
    }

    public void setMyBrokerage(Double myBrokerage) {
        this.myBrokerage = myBrokerage;
    }

    public Double getNotBalance() {
        return notBalance;
    }

    public void setNotBalance(Double notBalance) {
        this.notBalance = notBalance;
    }

    public Double getCanWithdrawal() {
        return canWithdrawal;
    }

    public void setCanWithdrawal(Double canWithdrawal) {
        this.canWithdrawal = canWithdrawal;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        MemberCopartnerCount that = (MemberCopartnerCount) o;

        if (memberId != null ? !memberId.equals(that.memberId) : that.memberId != null) return false;
        if (applyNum != null ? !applyNum.equals(that.applyNum) : that.applyNum != null) return false;
        if (orderNum != null ? !orderNum.equals(that.orderNum) : that.orderNum != null) return false;
        if (successNum != null ? !successNum.equals(that.successNum) : that.successNum != null) return false;
        if (totalMoney != null ? !totalMoney.equals(that.totalMoney) : that.totalMoney != null) return false;
        return totalBrokerage != null ? totalBrokerage.equals(that.totalBrokerage) : that.totalBrokerage == null;

    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (memberId != null ? memberId.hashCode() : 0);
        result = 31 * result + (applyNum != null ? applyNum.hashCode() : 0);
        result = 31 * result + (orderNum != null ? orderNum.hashCode() : 0);
        result = 31 * result + (successNum != null ? successNum.hashCode() : 0);
        result = 31 * result + (totalMoney != null ? totalMoney.hashCode() : 0);
        result = 31 * result + (totalBrokerage != null ? totalBrokerage.hashCode() : 0);
        return result;
    }


    @Override
    public String toString() {
        return "MemberCopartnerCount{" +
                "memberId='" + memberId + '\'' +
                ", applyNum=" + applyNum +
                ", orderNum=" + orderNum +
                ", successNum=" + successNum +
                ", totalMoney=" + totalMoney +
                ", totalBrokerage=" + totalBrokerage +
                ", lowerNum=" + lowerNum +
                ", myCommission=" + myCommission +
                '}';
    }
}
